<template>
    <div>
        <el-card class="ep-card ep-search">
            <el-row :gutter="0">
              <el-col :span="2" style="float:right">
                <el-button type="success"  @click="save">保存</el-button>
              </el-col>
            </el-row>
          </el-card>
     <el-card header="企业情况信息">
      <el-form :model="formData" label-width="140px" size="mini">
          <el-form-item label="企业历史沿革、发展方向、发展战略" prop="hisDeveEnter">
            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="formData.hisDeveEnter" style="width: 100%;"></el-input>
          </el-form-item>
          <el-form-item label="企业其他情况" prop="otherBusSitu">
            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="formData.otherBusSitu" style="width: 100%;"></el-input>
          </el-form-item>
          <el-form-item label="企业管理现状、管理层关系、稳定性及对管理层的业内人士评价" prop="evaluate">
            <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="formData.evaluate" style="width: 100%;"></el-input>
          </el-form-item>
          <el-form-item label="公司人员" prop="companyPerson">
            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="formData.companyPerson" style="width: 100%;"></el-input>
          </el-form-item>
           <el-form-item label="其他" prop="other">
            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="formData.other" style="width: 100%;"></el-input>
          </el-form-item>
      </el-form>
      </el-card>
    </div>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      projId:'',
      isSaveOrUpdate:false,
      formData:{
          hisDeveEnter: "",
          otherBusSitu: "",
          companyPerson: "",
          evaluate: "",
          other: ""
      },
    };
  },
  computed: {},
  mounted() {
 
  },
  methods: {
    init(projId){
          this.projId=projId;
          this.$api.formPost( 'biz/projEnterInfo/doGetList',{
                    projId:projId
                  }).then(res => {
                    if(res.retHead.code=="0000000"){
                        let isSaveOrUpdate=false;
                        if(res.retBody.list.length>0){
                          this.formData=res.retBody.list[0];
                           isSaveOrUpdate=true;
                        }
                        this.isSaveOrUpdate=isSaveOrUpdate;
                    }else{
                        this.$message({
                            type: 'error',
                            message: res.retHead.message
                        });
                    }
                });
     },
    save(){
      let user=JSON.parse(sessionStorage.getItem("user"));
      this.formData.createUserId=user.id;
      this.formData.createUserName=user.realName;
      this.formData.projId=this.projId;
      if(!this.isSaveOrUpdate){
        this.$api.formPost( 'biz/projEnterInfo/doSave',this.formData).then(res => {
                if(res.retHead.code=="0000000"){
                    
                      this.$message({
                          type: 'success',
                          message: "保存成功！"
                      });
                      this.formData={};
                      this.$emit("hiddenComponent");
                  }else{
                  
                      this.$message({
                          type: 'error',
                          message: res.retHead.message
                      });
                  }
          });
      }else{
        //更新
        this.formData.createTime=new Date();
        this.$api.formPost( 'biz/projEnterInfo/doModById',this.formData).then(res => {
                if(res.retHead.code=="0000000"){
                      this.$message({
                          type: 'success',
                          message: "更新成功！"
                      });
                      this.formData={};
                      this.$emit("hiddenComponent");
                  }else{
                  
                      this.$message({
                          type: 'error',
                          message: res.retHead.message
                      });
                  }
          });
      }
      
    },
    getdata(){
      return this.formData
    }

  },
  created() {}
};
</script>
<style lang='scss' scoped>

</style>